﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace mEdit
{
	public static class MRU
	{
		private static ToolStripMenuItem _rootItem;

		public static void SetRootItem(ToolStripMenuItem rootItem)
		{
			_rootItem = rootItem;
		}

		public static void CreateMRUMenu()
		{

			//AddMRU(Properties.Settings.Default.LastOpenedFile);
			//AddMRU(Properties.Settings.Default.MRU);
			//AddMRU(Properties.Settings.Default.MRU2);
			//AddMRU(Properties.Settings.Default.MRU3);
			//AddMRU(Properties.Settings.Default.MRU4);
		}

		private static void AddMRU(string fileName)
		{
			if (string.IsNullOrEmpty(fileName))
				return;
			ToolStripMenuItem tsmi = new ToolStripMenuItem(fileName);
			//tsmi.Click += new EventHandler(tsmiMRU_Click);
			_rootItem.DropDownItems.Add(tsmi);
		}

		public static void ClearMRUMenu()
		{
			_rootItem.DropDownItems.Clear();
		}

		public static void ReorganizeMRUMenu(string fileName)
		{
			string[] mru = Properties.Settings.Default.LastOpenedFile.Split( new char[] { ';'} );
			//foreach( string s in mru )
			//{
			//    if ( s ==  )

			//}
		}

		private static void RemoveEmptyEntries()
		{

		}
	}
}
